﻿#include <iostream>
#include <string>
using namespace std;
struct S
{
	string name;
	int score;
}s;
int main()
{
	int n = 0;
	cin >> n;
	struct S max = { "", 0 };
	cin >> max.score >> max.name;
	n--;
	while (n--)
	{
		cin >> s.score >> s.name;
		if (s.score > max.score) 
		{
			max.score = s.score;
			max.name = s.name;
		}
		
	}
	cout << max.name << endl;
	return 0;
}
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
const int N = 110;
struct S
{
	string name;
	int score;
}s[N];
//
⽐较⽅法

bool cmp(S s1, S s2)
{
	return s1.score > s2.score;
}
int main()
{
	int n = 0;
	cin >> n;
	int i = 0;
	int t = n;
	//
	输⼊数据

		比特就业课
		while (t--)
		{
			cin >> s[i].score >> s[i].name;
			i++;
		}
	//
	降序排序

		sort(s, s + n, cmp);
	cout << s[0].name << endl;
	return 0;
}